Embedded Networking and Communications

Texto Justificado

Group assignment:

  • Send a message between two projects.
  • Document your work to the group work page and reflect on your individual page what you learned.

Individual assignments

  • design, build and connect wired or wireless node(s) with network or bus addresses and a local interface.

Group Assignment

  • Here is the link where you can see the development of the week's group assignment.Group Assignment

Imagen

Shared use to turn on an actuator

In this step it is crucial to activate sharing within your account, as interaction will be required. An invitation was made to another person, in my case a colleague from Fabacademy

Imagen


Imagen

Configure the Thins and here you see the code

Once sharing is enabled, we proceed to create the dashboard, device and thing on the Arduino IoT Cloud platform and then configure them according to our needs.

Imagen


Imagen

Upload the code and make the dashboard work

Once the interaction is configured and created, which can include anything from an LED to actuators, the next step is to configure the WiFi credentials, password and security key. Subsequently, we proceed to load the program into the XIAO ESP32 with the desired interaction

Imagen


Imagen

Video of how the group task works




In summary

A key lesson I learned in this activity was the importance of making sure the Arduino Cloud virtual agent is installed correctly. I did not initially notice this detail, as the program loading seemed successful, but the final installation did not complete. I later discovered that I had completely skipped installing the necessary agent. Once I installed the agent correctly, everything ran smoothly and was ready to test.



Individual assignment

For my individual assignment this week, I used the XIAO ESP32-C3 along with the WiFi communication protocol. This choice allowed me to move forward on our final project while taking advantage of the capabilities of this device.

Connection via Wi-Fi communication protocol

To use the XIAO ESP32-C3 with Arduino to connect to the Arduino IoT Cloud via Wi-Fi, follow these steps to configure and program your device:


Imagen

Step 1: Hardware Preparation

XIAO ESP32-C3 Board:

  • Make sure you have a XIAO ESP32-C3 board compatible with the Arduino development environment.

USB connection:

  • Connect the XIAO ESP32-C3 board to your computer using a USB-C cable.

Step 2: Arduino IoT Cloud Setup

Registration in Arduino IoT Cloud:

  • Register in Arduino IoT Cloud (cloud.arduino.cc) and create a new project.

Imagen


Imagen

Add Devices to Project:

  • Add your XIAO ESP32 C3 board to the project from the IoT Cloud interface.
Imagen


Imagen

Imagen

In setup we choose the correct board.


Imagen

Now we select the correct device.

Imagen

Naming the project.


Imagen

Downloading project credentials.

  • From the "Sketch" tab, click "Add Device."
  • Select your device and click "Next."
  • Select the properties you want to include in your code (be sure to select the property you just created to control the LED).
Imagen

.


Imagen

.


Imagen

.


Imagen

.


Imagen

.


Imagen

.


Step 3: Generate the Code in Arduino IoT Cloud

Implement the code necessary for your Arduino to communicate with the Arduino IoT Cloud. This includes configuring project parameters and reading/sending data to/from connected devices.


Imagen

.


Imagen

.


Imagen

.


Imagen

.


Imagen

.


Imagen

.


Step 4: Modify the Code to Control the LED

Set the LED Pin:


  • In the generated code, identify the pin your LED is connected to on the XIAO ESP32-C3 board. For example.

                            const int ledPin = 2; // Example: LED connected to pin 13
                            

Implement the Logic to Control the LED:

  • Inside the loop() of the code, read the state of the "LEDControl" property from the Arduino IoT Cloud and use this state to turn the LED on or off. For example:

                            void loop() {
                                ArduinoCloud.update();
                            
                                // Control del LED
                                if (LEDControl) {
                                digitalWrite(ledPin, HIGH); // on LED
                                } else {
                                digitalWrite(ledPin, LOW); // off LED
                                }
                            }
                        

Code


Step 5: Upload the Code to your Device

Connect your Device and Upload the Code:

  • Connect your XIAO ESP32-C3 board to your computer.
  • Select the correct board and port on the Arduino IDE.
  • Upload the modified code to your device.

Imagen

.


Imagen

.


Step 6: Control the LED from the Dashboard

Access the Arduino IoT Cloud Dashboard:

  • Go to the "Dashboard" section in Arduino IoT Cloud.

Add a Widget to Control the LED:

  • Click "Add Widget" and select the appropriate widget to control the "LEDControl" property.
  • Configure the widget so that it can turn the LED on and off.

Imagen

.


Imagen

.



Wifi communication through IOT Cloud Arduino of an Actuator and Turbidity sensor

As part of my project, I implemented a system to measure water turbidity and conducted tests using three different types of water. This process allowed me to analyze and compare turbidity in different samples, thus contributing to the objectives and results of my research.



Imagen


Once the account has been created, the next step in this process is to configure another device to be able to read the turbidity sensor data. In addition, it is required to implement the functionality to control the on and off of a solenoid valve. This stage will allow the integration of turbidity measurement capabilities with the control of the water treatment system, which is essential for the successful development of this project

Imagen

.


Imagen

.


After that, we proceed to configure which sensors and outputs we want to display on the control panel (Dashboard). In addition, we select the appropriate device to integrate with the Dashboard and configure the WiFi network name, the network password and finally the security key (key) necessary for the connection. This configuration phase will allow us to customize and optimize the display of data in the Dashboard, ensuring a fluid and secure integration of our system with the network and the selected devices.


Imagen

.


Imagen

.


In the next step, we proceed to enter the integrated development environment (IDE) or Sketch, where we will write the code that will be loaded into the XIAO. To access this environment, we click on option number 2 called 'editor', which will take us to the workspace necessary to program and configure the XIAO ESP32 device.


Code

Imagen

.


Imagen

.


After this, we add our code and proceed to load it on our XIAO ESP32 device

Imagen

.


Imagen

.


As a result of the values ​​obtained, we can view the data from the turbidity sensor and control an actuator (such as a 220V pump) to activate or deactivate it.


Imagen

.





In summary

This week has been very productive, since I learned to establish communication between the XIAO ESP32 C3 and the WiFi, which has allowed me to control an actuator, in this case a solenoid valve, from a web platform. In addition, I was also able to turn this solenoid valve on and off from my cell phone, using the Arduino IOT cloud platform. I'm excited about the many applications and projects I can explore, such as integrating functionality with ALEXA and other applications.

However, not everything was so fast and fluid. I encountered some difficulties, such as the fact that some public institutions, such as the university where I work, impose certificates on their WiFi networks, which limits our total control over them. At first, I thought the problem was in my code, but after reviewing it thoroughly, I realized that everything was correct. To test it, I shared the connection from my cell phone as an access point and it worked without problems. This allowed me to confirm that everything was fine, and I was then able to test it on other WiFi networks in my house, where everything worked correctly.

Links to all working files used this week

1. LED from the Dashboard.zip